package com.niit.entity;

import com.niit.entity.embeddable.MenuRoleId;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Entity
@Table(name = "menus_roles")
@NoArgsConstructor
@AllArgsConstructor
public class MenuRole {
    @EmbeddedId
    private MenuRoleId id;

    @ManyToOne
    @MapsId("menuId")
    @JoinColumn(name = "menu_id")
    private Menu menu;

    @ManyToOne
    @MapsId("roleId")
    @JoinColumn(name = "role_id")
    private Role role;
}
